<!--#
layout("/layouts/platform.html"){
#-->
<!--后台用户管理页面-->
<div id="app" v-cloak>
    <el-row  class="header navbar bg-white shadow">
        <el-row>
            <!--搜索条件-->
            <div class="btn-group tool-button mt5">
                <el-date-picker
                        v-model="searchDate"
                        type="datetimerange"
                        :picker-options="pickerOptions"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        align="right"
                        size="medium"
                        :default-time="['00:00:00', '23:59:59']"
                        value-format="yyyy-MM-dd HH:mm:ss">
                </el-date-picker>
            </div>
            <!--搜索框-->
            <div class="btn-group tool-button mt5">
                <el-input v-model="pageForm.searchKeyword" @keyup.enter.native="doSearch" placeholder="昵称或者手机号码"
                          size="medium"></el-input>
            </div>
            <!--新增按钮-->
            <div class="pull-right offscreen-right mt5">
                <el-button size="medium" @click="openAdd"><i class="ti-plus"></i>添加用户</el-button>
            </div>
            <!--        <div class="pull-right offscreen-right mt5">-->
            <!--            <el-button size="medium" @click="turnOver" title="所有按钮反选"><i class="ti-plus"></i>反转</el-button>-->
            <!--        </div>-->
            <div class="pull-right offscreen-right mt5">
                <el-button size="medium" @click="goDie" title="集体下线">集体下线</el-button>
            </div>
            <div class="pull-right offscreen-right mt5">
                <el-button type="info" size="medium" @click="closeAllPlayable">一键关闭游戏大厅</el-button>
            </div>
            <div class="pull-right offscreen-right mt5">
                <el-button type="primary" size="medium" @click="openAllPlayable">一键开启游戏大厅</el-button>
            </div>
            <br>
            <div class="btn-group tool-button mt5">
                <el-checkbox v-model="isOnline">是否在线</el-checkbox>
            </div>
            <div class="btn-group tool-button mt5">
                <el-checkbox v-model="disabled">是否禁用</el-checkbox>
            </div>
            <div class="btn-group tool-button mt5">
                <el-checkbox v-model="isAnchor">是否主播</el-checkbox>
            </div>
            <div class="btn-group tool-button mt5">
                <el-checkbox v-model="isRoomManager">是否房管</el-checkbox>
            </div>
            <div class="btn-group tool-button mt5">
                <el-checkbox v-model="sessionDisabled">是否禁言</el-checkbox>
            </div>
            <div class="btn-group tool-button mt5">
                <el-checkbox v-model="isCollect">是否收款</el-checkbox>
            </div>
            <div class="btn-group tool-button mt5">
                <el-checkbox v-model="playable">游戏大厅</el-checkbox>
            </div>
            <div class="btn-group tool-button mt5">
                <el-checkbox v-model="isAgent">是否代理</el-checkbox>
            </div>
            <div class="btn-group tool-button mt5">
                <el-checkbox v-model="isCertified">是否认证</el-checkbox>
            </div>
            <div class="btn-group tool-button mt5">
                <el-checkbox v-model="isAttendant">是否客服</el-checkbox>
            </div>
            <!--搜索按钮-->
            <div class="btn-group tool-button mt5">
                <el-button slot="append" icon="el-icon-search" @click="doSearch" size="medium"></el-button>
            </div>
        </el-row>
    </el-row>
    <el-row class="el-table-container" style="padding-top:85px">
        <el-table
                :data="tableData"
                size="small"
                header-align="center"
                style="width: 100%">
            <!--头像-->
            <el-table-column
                    fixed="left"
                    prop="headPicture"
                    label="头像"
                    header-align="center"
                    :show-overflow-tooltip="true"
                    align="center">
                <template scope="scope">
                    <p v-if="scope.row.headPicture && scope.row.headPicture.substring(0, 1) == '/'">
                        <img :src="scope.row.headPicture" style="width: 60px;height: 60px">
                    </p>
                    <p v-else-if="scope.row.headPicture && scope.row.headPicture.substring(0, 1) != '/'">
                        <img :src="'/' + scope.row.headPicture" style="width: 60px;height: 60px">
                    </p>
                    <p v-else>
                        暂无数据
                    </p>
                </template>
            </el-table-column>
            <!--昵称-->
            <el-table-column
                    fixed="left"
                    label="昵称"
                    prop="nickName"
                    header-align="center"
                    :show-overflow-tooltip="true"
                    align="center">
            </el-table-column>
            <!--用户名-->
            <el-table-column
                    fixed="left"
                    prop="userName"
                    label="用户名"
                    header-align="center"
                    align="center">
            </el-table-column>
            <!--手机号码-->
            <el-table-column
                    fixed="left"
                    prop="phone"
                    label="手机号码"
                    header-align="center"
                    width="120px"
                    align="center">
            </el-table-column>
            <!--邀请码-->
            <el-table-column
                    fixed="left"
                    prop="inviteCode"
                    label="邀请码"
                    header-align="center"
                    align="center">
            </el-table-column>
            <!--User类型-->
            <el-table-column
                    prop="anchor"
                    label="是否主播"
                    header-align="center"
                    align="center">
                <template slot-scope="scope">
                    <i v-if="scope.row.anchor" class="fa fa-circle text-success ml5"></i>
                    <i v-if="!scope.row.anchor" class="fa fa-circle text-danger ml5"></i>
                </template>
            </el-table-column>
            <el-table-column
                    prop="anchorHeat"
                    label="主播热度"
                    header-align="center"
                    align="center">
                <template slot-scope="scope">
                    {{getHeatName(scope.row.anchorHeat)}}
                </template>
            </el-table-column>
            <!--禁言设置-->
            <el-table-column
                    prop="sessionDisabled"
                    label="是否禁言"
                    header-align="center"
                    align="center">
                <template slot-scope="scope">
                    <i v-if="scope.row.sessionDisabled" class="fa fa-circle text-success ml5"></i>
                    <i v-if="!scope.row.sessionDisabled" class="fa fa-circle text-danger ml5"></i>
                </template>
            </el-table-column>
            <!--默认房管设置-->
            <el-table-column
                    sortable
                    prop="roomManager"
                    label="默认房管"
                    header-align="center"
                    width="100px"
                    align="center">
                <template slot-scope="scope">
                    <i v-if="scope.row.roomManager" class="fa fa-circle text-success ml5"></i>
                    <i v-if="!scope.row.roomManager" class="fa fa-circle text-danger ml5"></i>
                </template>
            </el-table-column>
            <!--是否可收款权限设置-->
            <el-table-column
                    prop="isCollect"
                    label="收款权限"
                    header-align="center"
                    align="center">
                <template slot-scope="scope">
                    <i v-if="scope.row.isCollect" class="fa fa-circle text-success ml5"></i>
                    <i v-if="!scope.row.isCollect" class="fa fa-circle text-danger ml5"></i>
                </template>
            </el-table-column>
            <!--是否可进入游戏大厅-->
            <el-table-column
                    prop="playable"
                    label="游戏大厅"
                    header-align="center"
                    align="center">
                <template slot-scope="scope">
                    <i v-if="scope.row.playable" class="fa fa-circle text-success ml5"></i>
                    <i v-if="!scope.row.playable" class="fa fa-circle text-danger ml5"></i>
                </template>
            </el-table-column>
            <el-table-column
                    prop="agent"
                    label="代理人"
                    header-align="center"
                    align="center">
                <template slot-scope="scope">
                    <i v-if="scope.row.agent" class="fa fa-circle text-success ml5"></i>
                    <i v-if="!scope.row.agent" class="fa fa-circle text-danger ml5"></i>
                </template>
            </el-table-column>
            <el-table-column title="是否可以发布观点推荐"
                             prop="certified"
                             label="已认证"
                             header-align="center"
                             align="center">
                <template slot-scope="scope">
                    <i v-if="scope.row.certified" class="fa fa-circle text-success ml5"></i>
                    <i v-if="!scope.row.certified" class="fa fa-circle text-danger ml5"></i>
                </template>
            </el-table-column>
            <!--User启用状态-->
            <el-table-column
                    prop="disabled"
                    label="禁用"
                    header-align="center"
                    align="center">
                <template slot-scope="scope">
                    <i v-if="scope.row.disabled" class="fa fa-circle text-success ml5"></i>
                    <i v-if="!scope.row.disabled" class="fa fa-circle text-danger ml5"></i>
                </template>
            </el-table-column>
            <!--客服-->
            <el-table-column
                    prop="attendant"
                    label="客服"
                    header-align="center"
                    align="center">
                <template slot-scope="scope">
                    <i v-if="scope.row.attendant" class="fa fa-circle text-success ml5"></i>
                    <i v-if="!scope.row.attendant" class="fa fa-circle text-danger ml5"></i>
                </template>
            </el-table-column>
            <!--是否在线-->
            <el-table-column
                    fixed="right"
                    prop="isOnline"
                    label="是否在线"
                    header-align="center"
                    align="center">
                <template slot-scope="scope">
                    <i v-if="scope.row.isOnline" class="fa fa-circle text-success ml5"></i>
                    <i v-if="!scope.row.isOnline" class="fa fa-circle text-danger ml5"></i>
                </template>
            </el-table-column>
            <!--登录ip-->
            <el-table-column
                    fixed="right"
                    prop="ip"
                    label="登录ip"
                    header-align="center"
                    width="120px"
                    align="center">
                <template slot-scope="scope">
                    <span v-if="scope.row.ip !== null">{{scope.row.ip}}</span>
                    <span v-else>未登录</span>
                </template>
            </el-table-column>
            <!--最后登录时间-->
            <el-table-column
                    fixed="right"
                    prop="lastLoginAt"
                    label="最后登录时间"
                    header-align="center"
                    align="center"
                    width="120px">
                <template slot-scope="scope">
                    {{formatAt(scope.row.lastLoginAt)}}
                </template>
            </el-table-column>
            <!--总登录时长(h)-->
            <el-table-column
                    fixed="right"
                    prop="loginDuration"
                    label="总登录时长(h)"
                    header-align="center"
                    align="center"
                    width="120px">
            </el-table-column>
            <!--操作下拉菜单-->
            <el-table-column
                    fixed="right"
                    label="操作"
                    width="120"
                    align="center">
                <template slot-scope="scope">
                    <el-dropdown @command="dropdownCommand">
                        <el-button size="mini">
                            <i class="ti-settings"></i>
                            <span class="ti-angle-down"></span>
                        </el-button>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item divided :command="{type:'edit',id:scope.row.id}">
                                修改
                            </el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </template>
            </el-table-column>
        </el-table>
    </el-row>
    <!--分页容器-->
    <el-row class="el-pagination-container">
        <div class="pull-left offscreen-right mt5">
            <el-pagination
                    @size-change="pageSizeChange"
                    @current-change="pageNumberChange"
                    :current-page="pageForm.pageNumber"
                    :page-sizes="[10, 20, 30, 50]"
                    :page-size="pageForm.pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="pageForm.totalCount">
            </el-pagination>
        </div>
        <div class="pull-right offscreen-right mt5">
            <span style="color: red">在线人数： {{onlineNum}}</span>
        </div>
    </el-row>
    <!--新增/修改按钮弹出的dialog-->
    <el-dialog
            :title="titlePopu==0?'新增User':'修改User'"
            :visible.sync="editDialogVisible"
            :close-on-click-modal="false"
            width="40%">
        <el-row>
            <el-form :model="formData" ref="editForm" :rules="formRules" size="small" label-width="80px">
                <!--            新增/修改昵称input-->
                <el-form-item prop="nickName" :label="titlePopu==0?'输入昵称':'修改昵称'">
                    <el-input maxlength="100" :placeholder="titlePopu==0?'输入昵称':'修改昵称'"
                              v-model="formData.nickName"
                              :disabled="titlePopu==0?false:true"
                              auto-complete="off"
                              tabindex="1"
                              type="text"
                    >
                    </el-input>
                </el-form-item>
                <!--            新增/修改手机input-->
                <el-form-item prop="phone" :label="titlePopu==0?'输入手机':'修改手机'">
                    <el-input maxlength="100"
                              :placeholder="titlePopu==0?'输入手机':'修改手机'"
                              v-model="formData.phone"
                              auto-complete="off"
                              tabindex="1"
                              type="text">
                    </el-input>
                </el-form-item>
                <el-form-item prop="password" v-if="titlePopu==0" label="输入密码">
                    <el-input maxlength="100"
                              :placeholder="titlePopu==0?'输入密码':'修改密码'"
                              v-model="formData.pwd"
                              auto-complete="off"
                              :value="titlePopu==0?'123456':''"
                              tabindex="1"
                              type="password">
                    </el-input>
                </el-form-item>
                <el-form-item prop="inviteCode" v-if="titlePopu==0" label="输入邀请码">
                    <el-input maxlength="100"
                              v-model="formData.inviteCode"
                              auto-complete="off"
                              tabindex="1"
                              type="text">
                    </el-input>
                </el-form-item>
                <!--            新增/修改User类型switch-->

                <el-col :span="6">
                    <!--禁言设置-->
                    <el-form-item
                            prop="sessionDisabled"
                            label="是否禁言">
                        <el-switch
                                v-model="formData.sessionDisabled"
                                active-color="#13ce66"
                                inactive-color="#909399">
                        </el-switch>
                    </el-form-item>
                </el-col>

                <el-col :span="6">
                    <!--默认房管设置-->
                    <el-form-item
                            sortable
                            prop="roomManager"
                            label="默认房管">
                        <el-switch
                                v-model="formData.roomManager"
                                active-color="#13ce66"
                                inactive-color="#909399">
                        </el-switch>
                    </el-form-item>
                </el-col>

                <el-col :span="6">
                    <!--是否可收款权限设置-->
                    <el-form-item
                            prop="isCollect"
                            label="收款权限">
                        <el-switch
                                v-model="formData.isCollect"
                                active-color="#13ce66"
                                inactive-color="#909399">
                        </el-switch>
                    </el-form-item>
                </el-col>

                <el-col :span="6">
                    <!--是否可进入游戏大厅-->
                    <el-form-item
                            prop="playable"
                            label="游戏大厅">
                        <el-switch
                                v-model="formData.playable"
                                active-color="#13ce66"
                                inactive-color="#909399">
                        </el-switch>
                    </el-form-item>
                </el-col>

                <el-col :span="6">
                    <!--是否是代理-->
                    <el-form-item
                            prop="agent"
                            label="代理人">
                        <el-switch
                                v-model="formData.agent"
                                active-color="#13ce66"
                                inactive-color="#909399">
                        </el-switch>
                    </el-form-item>
                </el-col>

                <el-col :span="6">
                    <!--是否可以发布观点推荐-->
                    <el-form-item title="是否可以发布观点推荐"
                                  prop="certified"
                                  label="已认证">
                        <el-switch
                                v-model="formData.certified"
                                active-color="#13ce66"
                                inactive-color="#909399">
                        </el-switch>
                    </el-form-item>
                </el-col>

                <el-col :span="6">
                    <!--User启用状态-->
                    <el-form-item
                            prop="disabled"
                            label="禁用">
                        <el-switch
                                v-model="formData.disabled"
                                active-color="#13ce66"
                                inactive-color="#909399">
                        </el-switch>
                    </el-form-item>
                </el-col>

                <el-col :span="6">
                    <!--客服-->
                    <el-form-item
                            prop="attendant"
                            label="客服">
                        <el-switch
                                v-model="formData.attendant"
                                active-color="#13ce66"
                                inactive-color="#909399">
                        </el-switch>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <!--User类型-->
                    <el-form-item
                            prop="anchor"
                            label="是否主播">
                        <el-switch
                                v-model="formData.anchor"
                                active-color="#13ce66"
                                inactive-color="#909399">
                        </el-switch>
                    </el-form-item>
                </el-col>

                <el-col :span="12">
                    <el-form-item
                            prop="anchorHeat"
                            label="主播热度">
                        <el-select v-model="formData.anchorHeat" placeholder="请选择主播热度"
                                   size="medium">
                            <el-option
                                    v-for="item in heatDate"
                                    :key="item.val"
                                    :label="item.name"
                                    :value="item.val">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-form>
        </el-row>
        <!--        确认/取消 提交修改按钮-->
        <el-row>
            <el-col :span="8">
                <span>&nbsp;</span>
            </el-col>
            <el-col :span="8">
                <el-button @click="editDialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="doEdit">确 定</el-button>
            </el-col>
            <el-col :span="8">
                <span>&nbsp;</span>
            </el-col>
        </el-row>
    </el-dialog>
</div>
<script src="${base!}/assets/platform/js/sha256.js"></script>
<script>
    vue = new Vue({
        el: "#app",
        data: function () {
            return {
                pickerOptions: {
                    disabledDate: function (time) {
                        var threeMonths = moment().add(-3, 'months').valueOf();
                        return time.getTime() > new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1)
                            || time.getTime() < threeMonths;
                    },
                    shortcuts: [{
                        text: '最近一周',
                        onClick: function (picker) {
                            var end = new Date();
                            var start = new Date();
                            var temp = moment().add(-1, 'weeks').valueOf();
                            start.setTime(temp);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近一个月',
                        onClick: function (picker) {
                            var end = new Date();
                            var start = new Date();
                            var temp = moment().add(-1, 'months').valueOf();
                            start.setTime(temp);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近三个月',
                        onClick: function (picker) {
                            var end = new Date();
                            var start = new Date();
                            var temp = moment().add(-3, 'months').valueOf();
                            start.setTime(temp);
                            picker.$emit('pick', [start, end]);
                        }
                    }]
                },
                heatDate: [{
                    val: 0,
                    name: '凉凉'
                },{
                    val: 1,
                    name: '温'
                },{
                    val: 2,
                    name: '小热'
                },{
                    val: 3,
                    name: '中热'
                },{
                    val: 4,
                    name: '大热'
                },{
                    val: 5,
                    name: '最热'
                }],
                searchDate: [],
                addDialogVisible: false,
                editDialogVisible: false,
                isOnline: false,
                disabled: false,
                isAnchor: false,
                isRoomManager: false,
                sessionDisabled: false,
                isCollect: false,
                playable: false,
                isAgent: false,
                isCertified: false,
                isAttendant: false,
                titlePopu: 0,
                tableData: [],
                pageForm: {
                    pageNumber: 1,
                    pageSize: 10,
                    totalCount: 0,
                    userType: "",
                    searchKeyword: "",
                    searchDate: "",
                    conditionData: "",
                },
                formData: {
                    nickname: "",
                    phone: "",
                },
                formRules: {
                    // 新增User昵称必须填写。修改User暂时没有修改昵称功能。
                    nickName: [
                        {required: true, message: '请输入昵称', trigger: 'blur'}
                    ],
                    phone: [
                        {required: true, message: '请输入手机号', trigger: 'blur'}
                    ]
                },
                onlineNum: 0
            }
        },
        methods: {
            getHeatName:function(val){
                for (let heatDateKey in this.heatDate) {
                    if (this.heatDate[heatDateKey].val === val) {
                        return this.heatDate[heatDateKey].name;
                    }
                }
            },
            formatAt: function (val) {
                if (val > 0)
                    return moment(val * 1000).format("YYYY-MM-DD HH:mm");
                return "";
            },
            pageNumberChange: function (val) {//页码更新操作
                this.pageForm.pageNumber = val;
                this.pageData();
            },
            pageSizeChange: function (val) {//分页大小更新操作
                this.pageForm.pageSize = val;
                this.pageData();
            },
            pageData: function () {//加载分页数据
                var self = this;
                sublime.showLoadingbar();//显示loading
                if (self.searchDate) {
                    self.pageForm.searchDate = self.searchDate.toString();
                } else {
                    self.pageForm.searchDate = "";
                }
                self.pageForm.conditionData = "";
                if (self.isOnline) {
                    if (self.pageForm.conditionData === "") {
                        self.pageForm.conditionData = "isOnline";
                    } else {
                        self.pageForm.conditionData = self.pageForm.conditionData + ",isOnline";
                    }
                }
                if (self.disabled) {
                    if (self.pageForm.conditionData === "") {
                        self.pageForm.conditionData = "disabled";
                    } else {
                        self.pageForm.conditionData = self.pageForm.conditionData + ",disabled";
                    }
                }
                if (self.isAnchor) {
                    if (self.pageForm.conditionData === "") {
                        self.pageForm.conditionData = "isAnchor";
                    } else {
                        self.pageForm.conditionData = self.pageForm.conditionData + ",isAnchor";
                    }
                }
                if (self.isRoomManager) {
                    if (self.pageForm.conditionData === "") {
                        self.pageForm.conditionData = "isRoomManager";
                    } else {
                        self.pageForm.conditionData = self.pageForm.conditionData + ",isRoomManager";
                    }
                }
                if (self.sessionDisabled) {
                    if (self.pageForm.conditionData === "") {
                        self.pageForm.conditionData = "sessionDisabled";
                    } else {
                        self.pageForm.conditionData = self.pageForm.conditionData + ",sessionDisabled";
                    }
                }
                if (self.isCollect) {
                    if (self.pageForm.conditionData === "") {
                        self.pageForm.conditionData = "isCollect";
                    } else {
                        self.pageForm.conditionData = self.pageForm.conditionData + ",isCollect";
                    }
                }
                if (self.playable) {
                    if (self.pageForm.conditionData === "") {
                        self.pageForm.conditionData = "playable";
                    } else {
                        self.pageForm.conditionData = self.pageForm.conditionData + ",playable";
                    }
                }
                if (self.isAgent) {
                    if (self.pageForm.conditionData === "") {
                        self.pageForm.conditionData = "isAgent";
                    } else {
                        self.pageForm.conditionData = self.pageForm.conditionData + ",isAgent";
                    }
                }
                if (self.isCertified) {
                    if (self.pageForm.conditionData === "") {
                        self.pageForm.conditionData = "isCertified";
                    } else {
                        self.pageForm.conditionData = self.pageForm.conditionData + ",isCertified";
                    }
                }
                if (self.isAttendant) {
                    if (self.pageForm.conditionData === "") {
                        self.pageForm.conditionData = "isAttendant";
                    } else {
                        self.pageForm.conditionData = self.pageForm.conditionData + ",isAttendant";
                    }
                }
                $.post(base + "/platform/user/manager/data", self.pageForm, function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code === 0) {
                        self.tableData = data.data.pagination.list;
                        self.pageForm.totalCount = data.data.pagination.totalCount;
                        self.onlineNum = data.data.onlineNum;
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            doSearch: function () {
                this.pageForm.pageNumber = 1;
                this.pageData();
            },
            openAdd: function () {// 新建/修改User按钮逻辑
                var self = this;
                self.titlePopu = 0;
                this.editDialogVisible = true;
                if (this.$refs["editForm"]) {
                    this.$refs["editForm"].resetFields();
                }
                self.formData = {};
            },
            doEdit: function () { // 提交新增/修改
                var self = this;
                self.$refs["editForm"].validate(function (valid) {
                    if (valid) {
                        //titlePopu=0是新增,1是修改
                        if (self.titlePopu == 0) {
                            self.formData.password = sha256_digest(self.formData.pwd);
                            $.post(base + "/platform/user/manager/add", self.formData, function (data) {
                                if (data.code == 0) {
                                    self.$message({
                                        message: data.msg,
                                        type: 'success'
                                    });
                                    self.doSearch();
                                    self.editDialogVisible = false;
                                } else {
                                    self.$message({
                                        message: data.msg,
                                        type: 'error'
                                    });
                                }
                            }, "json");
                        } else {
                            $.post(base + "/platform/user/manager/editDo", self.formData, function (data) {
                                if (data.code == 0) {
                                    self.$message({
                                        message: data.msg,
                                        type: 'success'
                                    });
                                    self.doSearch();
                                    self.editDialogVisible = false;
                                } else {
                                    self.$message({
                                        message: data.msg,
                                        type: 'error'
                                    });
                                }
                            }, "json");
                        }
                    }
                });
            },
            goDie: function () {
                $.post(base + "/platform/user/manager/goDie", self.pageForm, function (data) {
                }, "json");
            },
            turnOver: function () {
                var sws = document.getElementsByClassName("el-switch__core");
                for (var i = 0; i < sws.length; i++) {
                    sws[i].click();
                }
            },
            anchor: function (row) {
                var _self = this;
                $.post(base + "/platform/user/manager/anchor", {disable: row.anchor, id: row.id}, function (data) {
                    _self.pageData()
                }, "json");
            },
            sessionDisable: function (row) {
                var _self = this;
                $.post(base + "/platform/user/manager/session", {
                    disable: row.sessionDisabled,
                    id: row.id
                }, function (data) {
                    _self.pageData()
                }, "json");
            },
            setManager: function (row) {
                var _self = this;
                $.post(base + "/platform/user/manager/manage", {flag: row.roomManager, id: row.id}, function (data) {
                    _self.pageData()
                }, "json");
            },
            setCollect: function (row) {
                var _self = this;
                $.post(base + "/platform/user/manager/isCollect", {
                    isCollect: row.isCollect,
                    id: row.id
                }, function (data) {
                    _self.pageData()
                }, "json");
            },
            setPlayable: function (row) {
                var _self = this;
                $.post(base + "/platform/user/manager/setPlayable", {
                    playable: row.playable,
                    id: row.id
                }, function (data) {
                    _self.pageData()
                }, "json");
            },
            setAgent: function (row) {
                var _self = this;
                $.post(base + "/platform/user/manager/setAgent", {agent: row.agent, id: row.id}, function (data) {
                    _self.pageData()
                }, "json");
            },
            setCertified: function (row) {
                var _self = this;
                $.post(base + "/platform/user/manager/setCertified", {
                    certified: row.certified,
                    id: row.id
                }, function (data) {
                    _self.pageData()
                }, "json");
            },
            setDisabled: function (row) {
                var _self = this;
                $.post(base + "/platform/user/manager/setDisabled", {
                    disabled: row.disabled,
                    id: row.id
                }, function (data) {
                    _self.pageData()
                }, "json");
            },
            setAttendant: function (row) {
                var _self = this;
                $.post(base + "/platform/user/manager/setAttendant", {
                    attendant: row.attendant,
                    id: row.id
                }, function (data) {
                    _self.pageData()
                }, "json");
            },
            dropdownCommand: function (command) {//监听下拉框事件
                var self = this;
                // 启用，禁用按钮
                if ("enable" == command.type || "disable" == command.type) {
                    $.post(base + "/platform/user/manager/" + command.type + "/" + command.id, {}, function (data) {
                        if (data.code == 0) {
                            self.$message({
                                message: data.msg,
                                type: 'success'
                            });
                            if ("disable" == command.type) {
                                command.row.disabled = true;
                            }
                            if ("enable" == command.type) {
                                command.row.disabled = false;
                            }
                        } else {
                            self.$message({
                                message: data.msg,
                                type: 'error'
                            });
                        }
                    }, "json");
                }
                // 修改按钮
                if ("edit" == command.type) {
                    $.post(base + "/platform/user/manager/edit/" + command.id, {}, function (data) {
                        if (data.code == 0) {
                            if (self.$refs["editForm"]) {// 清空校验提示
                                self.$refs["editForm"].resetFields();
                            }
                            // 加载后台表单数据
                            self.formData = data.data;
                            self.editDialogVisible = true;// 打开编辑窗口
                            self.titlePopu = 1;
                        } else {
                            self.$message({
                                message: data.msg,
                                type: 'error'
                            });
                        }
                    }, "json");
                }
            },
            openAllPlayable: function () {
                let self = this;
                self.$confirm('确定要开启所有人的游戏大厅功能？', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                    callback: function (a, b) {
                        if ("confirm" === a) {//确认后再执行
                            $.post(base + "/platform/user/manager/openAllPlayable", function (data) {
                                if (data.code === 0) {
                                    self.$message({
                                        message: data.msg,
                                        type: 'success'
                                    });
                                    self.doSearch();
                                } else {
                                    self.$message({
                                        message: data.msg,
                                        type: 'error'
                                    });
                                }
                            }, "json");
                        }
                    }
                });
            },
            closeAllPlayable: function () {
                let self = this;
                self.$confirm('确定要关闭所有人的游戏大厅功能？', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                    callback: function (a, b) {
                        if ("confirm" === a) {//确认后再执行
                            $.post(base + "/platform/user/manager/closeAllPlayable", function (data) {
                                if (data.code === 0) {
                                    self.$message({
                                        message: data.msg,
                                        type: 'success'
                                    });
                                    self.doSearch();
                                } else {
                                    self.$message({
                                        message: data.msg,
                                        type: 'error'
                                    });
                                }
                            }, "json");
                        }
                    }
                });
            }
        },
        created: function () {
            this.pageData();
        }
    });
</script>

<!--#
}
#-->